<%@ page language="java" contentType="text/html; charse=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>   
<jsp:include page="../tmp/header2.jsp"/>
				<div class="main-content" style="margin-left: 0px;padding-top: 0px;">
					<div class="breadcrumbs" id="breadcrumbs" style="left:0">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i><a href="/admin/welcome.html">主页</a></li>
							<li>${pname }</li><li>${name }</li>
						</ul><!-- .breadcrumb -->

						<div class="nav-search" id="nav-search">
							<form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="icon-search nav-search-icon"></i>
								</span>
							</form>
						</div><!-- #nav-search -->
					</div>

					<div class="page-content">
						<div class="page-header">
						<!-- 按钮 -->
							<a href="add.html?pname=${pname }&name=${name}" class="btn">
								<i class="icon-pencil align-top bigger-125"></i>
								添加
							</a>

							<a onclick="modify()" class="btn btn-primary">
								<i class="icon-pencil align-top bigger-125"></i>
								修改
							</a>

							<a onclick="del()" class="btn btn-info">
								删除
								<i class="icon-trash icon-2x  align-top bigger-125 icon-on-right"></i>
							</a>
						</div><!-- /.page-header -->
								<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="table-header">数据管理</div>
							<div class="table-responsive">
								<table id="sample-table-2" class="table table-striped table-bordered table-hover">
									<thead>
										<tr>
											<th class="center">
												<label><input type="checkbox" value="" class="ace" /><span class="lbl"></span></label>
											</th>
											<th>id</th>
											<th>标题</th>
											<th>来源地址</th>
									
											<th class="hidden-480">时间</th>
										</tr>
									</thead>

									<tbody>
										<c:forEach items="${data }" var="vo">
										<tr>
											<td class="center">
												<label>
													<input type="checkbox" class="ace" value="${vo.id }"/>
													<span class="lbl"></span>
												</label>
											</td>
											<td>${vo.id }</td>
											<td>${vo.title }</td>
											<td>${vo.sourceArticle }</td>
											
											<td class="hidden-480"><fmt:formatDate value="${vo.createtime }" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
										</tr>	
										</c:forEach>
									</tbody>
								</table>
								<jsp:include page="../tmp/page.jsp"/>
							
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->
<script type="text/javascript" src="/public/static/assets/js/jquery-2.0.3.min.js"></script>
<script type="text/javascript">
	window.onload = function(){
		//alert(1);
		
	}
	function del(){
		//alert(1)
		var cs = document.getElementsByClassName("ace");
			//console.log(cs.length);
			for(var i = 0; i < cs.length; i++){
				//console.log(cs[i].checked);
				if(cs[i].checked){
					
					 $.ajax({url:"/admin/CjSpotsBief/del.html?id="+cs[i].value,seccess:function(){
						alert("删除成功!");
						//document.location.reload();
						
					}}); 
					cs[i].parentNode.parentNode.parentNode.parentNode.removeChild(cs[i].parentNode.parentNode.parentNode);
				}
		}
	}
	function modify(){
		var cs = document.getElementsByClassName("ace");
		for(var i = 0; i < cs.length; i++){
			if(cs[i].checked){
				//alert(cs[i].value);
				window.location.href = "/admin/CjSpotsBief/modify.html?pname=${pname}&name=${name}&id="+cs[i].value;
				return;
			}
		}
		alert("请选择要修改的数据");
	}
	function page(index){
		var href = window.location.href;
		if(href.indexOf("page")>0){
			href = href.substring(0,href.indexOf("&page"));
		}
		if(index > 0){
			
		}else{
			index = 2;
		}
		window.location.href = href+ "&page="+index;
		
	}
</script>

